package com.zcp.service;

import com.zcp.dao.AddersDAO;
import com.zcp.entity.address;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.Date;
import java.util.List;

@Service
@Transactional
public class AddressServiceImpl implements AddressService {

    @Autowired
    private AddersDAO addersDAO;


    @Override
    @Transactional(propagation = Propagation.SUPPORTS)
    public List<address> findAll() {
        return addersDAO.findAll();
    }

    @Override
    public void save(address address) {
        address.setCreatetime(new Date());
        addersDAO.save(address);
    }

    @Override
    public address change(Integer id) {
        return addersDAO.change(id);
    }

    @Override
    public void changed(address address) {
        addersDAO.changed(address);
    }

    @Override
    public void delete(Integer id) {
        addersDAO.delete(id);
    }
}
